package jmine.tec.aom.services.include;

import jmine.tec.aom.domain.Property;
import jmine.tec.aom.domain.PropertyType;
import jmine.tec.services.annotations.Input;
import jmine.tec.services.annotations.ServiceImplementor;
import jmine.tec.services.api.ActionsEnum;
import jmine.tec.services.api.export.ReferenceMap;
import jmine.tec.services.export.impl.ExportUtils;
import jmine.tec.services.io.ServiceBean;

/**
 * Includes a new {@link Property}
 * 
 * @author jrenaut
 */
@ServiceImplementor(action = ActionsEnum.INCLUIR)
public class PropertyService extends AbstractPropertyService<Property> {

    public static final String TYPE = "Type";

    private PropertyType type;

    /**
     * {@inheritDoc}
     */
    @Override
    protected PropertyType getPropertyType() {
        return this.type;
    }

    /**
     * @param type the type to set
     */
    @Input(fieldName = TYPE)
    public void setType(PropertyType type) {
        this.type = type;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected void fillSpecificServiceBean(ServiceBean bean, ReferenceMap referenceMap, Property entity) {
        ExportUtils.put(bean, TYPE, entity.getPropertyType().getMnemonic());
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected Class<Property> getPropertyClass() {
        return Property.class;
    }

}
